<template>
  <section class="hero" id="wpsOffice" :style="{ display: activeTab === 'wpsOffice' ? 'block' : 'none' }">
    <h1>WPS Office</h1>
    <p>一站式办公服务平台<br>新升级，无广告，AI办公更高效</p>
    <div class="btn-group">
      <button class="btn download-btn">立即下载</button>
      <button class="btn online-btn">在线使用</button>
    </div>
    <p class="extra-info">
      <span class="more-download">更多下载</span> | 
      <span class="enterprise-link">了解企业版</span>
    </p>
    <div class="tab-bar">
      <div class="tab" :class="{ active: activeTab === 'wpsOffice' }" @click="handleTabClick('wpsOffice')">WPS Office</div>
      <div class="tab" :class="{ active: activeTab === 'wps365' }" @click="handleTabClick('wps365')">WPS 365</div>
    </div>
  </section>

  <section class="hero" id="wps365" :style="{ display: activeTab === 'wps365' ? 'block' : 'none' }">
    <h1>W365</h1>
    <p>面向组织和企业的 WPS 365<br>一站式AI办公，生产力即刻起飞</p>
    <button class="btn know-more-btn">了解更多</button>
    <div class="tab-bar">
      <div class="tab" :class="{ active: activeTab === 'wpsOffice' }" @click="handleTabClick('wpsOffice')">WPS Office</div>
      <div class="tab" :class="{ active: activeTab === 'wps365' }" @click="handleTabClick('wps365')">WPS 365</div>
    </div>
  </section>
</template>

<script setup>
import { ref } from 'vue';

const activeTab = ref('wpsOffice');

const handleTabClick = (tab) => {
  activeTab.value = tab;
};

// 对外暴露方法，方便父组件控制（若需要）
defineExpose({
  handleTabClick
});
</script>

<style scoped>
.hero {
  text-align: center;
  padding: 60px 20px;
  background-color: #f9fcff;
}

.hero h1 {
  font-size: 36px;
  margin-bottom: 20px;
  color: #333;
}

.hero p {
  font-size: 18px;
  margin-bottom: 30px;
  color: #666;
  line-height: 1.6;
}

.btn-group {
  margin-bottom: 20px;
}

.btn {
  padding: 12px 30px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  margin: 0 5px;
}

.download-btn {
  background-color: #e23c32;
  color: #fff;
}

.online-btn {
  background-color: #fff;
  color: #333;
  border: 1px solid #ccc;
}

.know-more-btn {
  background-color: #0078ff;
  color: #fff;
}

.extra-info {
  font-size: 14px;
  color: #999;
}

.more-download,
.enterprise-link {
  cursor: pointer;
}

.more-download:hover,
.enterprise-link:hover {
  text-decoration: underline;
}

.tab-bar {
  display: flex;
  justify-content: center;
  margin-top: 40px;
}

.tab {
  padding: 10px 30px;
  border: 1px solid #ddd;
  margin: 0 5px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.tab.active,
.tab:hover {
  background-color: #f0f0f0;
}
</style>